home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
a_utils
/
_archvrs
/
amiga
/
bin
/
lz192.doc
< prev
next >
Wrap
Text File
|
1991-08-20
|
26KB
|
705 lines
LZ 1.92
20th August, 1991
Written by Jonathan Forbes
Copyright ⌐ 1990, 1991, Xenomiga Technology
Distribution
This version of LZ is freely distributable for non-commercial use (including
distribution on the Fred Fish disks), provided that a brief note of credit or
a thank-you is included in a readme file somewhere.
If you use this program and like it, a small contribution of $15 (CDN$ or
US$) would be appreciated (send to the address below). Enquiries for
commercial use should also be sent to the address below:
Xenomiga Technology
1132 Bay Street
Toronto, Ontario
M5S 2Z4
If you wish, you can be placed on the mailing list, so that you will be
informed of upcoming products by Xenomiga Technology.
Previous Registrations
If you have previously registered LZ, then you do not need to re-register.
If you paid extra for updates to be automatically sent to you when available,
then these updates *will* be sent to you as LZ development continues.
This version of LZ is functionally equivalent to the registered version of
1.91, so if you registered, paid the extra fee for an update mailing, and
received 1.91, this particular version won't be mailed to you; the next
one will.
Disclaimer
I am in no way responsible for anything this program does; you are using it
entirely at your own risk! If you are using a hacked, edited, or tampered
with version of LZ, you are even more at risk.
What is LZ?
LZ is the fastest LZH archiver and extractor available for the Amiga! It
also produces smaller files than ANY other archiver. LZ is compatible with
both the original Lharc and the new LHA.
LZ is currently the only utility available for the Amiga which can archive
or extract in new, more efficient, LHA archive format.
Acknowledgements
The original Lharc (MS-DOS) was written by Haruyasu Yoshizaki. I took his
freely distributable source code "lzhuf.c", and rewrote it in assembly
language (very highly optimised assembly language, I might add). I used
"lharc.c" (which is full of MS-DOS specific code) as a reference, but did not
use it as a base for the Amiga version, which I wrote from scratch.
LZ 1.00 and above use modifications to the original Lharc algorithm for
extra compression and greater speed. These modifications are *not* present
in either the MS-DOS or Amiga version Lharc.
LZ 1.80 and above also use the LHA algorithm, also by Haruyasu Yoshizaki.
Why use LZ?
1. It produces smaller archives than any other Amiga archiver in existence.
2. It extracts files faster than any other popular Amiga archiver,
including Lharc, LharcA, PkaZip, Arc, Zoo, Pkax, and Ape.
3. It compresses files faster than any other archiver, except Zoo.
How fast is LZ?
LZ is currently the fastest .LZH utility for the Amiga. No other available
Amiga archiver even comes close to LZ's legendary performance for either
compressing or decompressing. LZ 1.90 can achieve peak compression speeds of
up to three times those of LZ 0.91.
Speedwise, LZ leaves everything else far behind in the dust; LZ outperforms
Lharc 1.3, LharcA .99d, Pkazip 1.01, Lhlib 1.8, and just about every other
Amiga archiving utility in existence.
Every now and then, the programmer of some new disk compressing utility
will make the ridiculous claim that his disk compressor uses some custom
algorithm derived from Lharc that is "superior to anything else out there".
Some will even go so far as to claim speed or compression superiority to LZ.
But the fact is, to date, there is simply NOTHING out there which even
comes close to LZ for degree of compression, and the programs which actually
do come within some large percentage of LZ's compression performance are
never anywhere near as fast as LZ. LZ simply smokes the competition in every
conceivable way.
In terms of degree of compression, LZ outperforms every other archiver
currently available for the Amiga.
The files being compressed and decompressed in the test, were those on
Fred Fish disk #245.
* - Different algorithm/encoding scheme
X - Lharc 1.0 algorithm
# - LHA 2.0 algorithm
# X X X X *
| (1.90) | (1.81) | (.91) | (1.0) | (.99d) | (1.01)
| LZ | LZ | LZ | Lharc | LharcA | PkaZip
Fish245.LZH | 8:01 | 5:33 | 11:33 | 26:29 | ? | 10:31 compressing
| :55 | 1:38 | 1:43 | 5:12 | 2:34 | 2:53 decompressing
| |
| |
V V
Size: 265721 283435
X X X X * * * *
File LZ LZ Lharc LharcA Pkazip Zoo Arc Ape
Name 1.90 0.91 1.3 .99d 1.01 2.01 0.23 1.0
---------- ----- ----- ----- ------ ------ ----- ----- -----
UserManual 88 244 268 211 164 42 112 614 <- compress
19 19 35 27 21 12 19 116 <- extract
64066 66693 66683 66682 61796 78279 80469 66329 <- size
#
File LZ
Name 1.90
---------- -----
UserManual 196 <- compress
12 <- extract {best extraction time}
60841 <- size {best compressed size}
Invokation
Typing "LZ" from the CLI, without any parameters, will reveal a help screen
similar to the following (with copyright and shareware information.)
Summary of commands:
a Add file(s) to archive f Freshen file(s) in archive
e,x Extract file(s) from archive u Update file(s) in archive
l,v Display archive contents t Test archive integrity
d Delete file(s) from archive m Move file(s) to archive
Summary of options:
-a Preserve file attributes -N No console output
-A Set archive flag -p Pause after loading
-b Set input/output buffer -P Set task priority
-c Confirm files -r Archive subdiectories
-D Alternative display -u Upper case filenames
-f Ignore filenotes -U Update rate
-i Read file list from file -v View mode
-l Lower case filenames -w Set work directory
-L Create list file -x Preserve path names
-m Disable message query -z Store files
-n No progress indicator -Z Compress archives
-0 Lharc compression -2 LHA compression
The usage line below is also displayed:
Usage: LZ [-options] <Command> <Archive> [FilePatterns] [DestPath]
While items in square brackets are optional, items in angle brackets are
mandatory. LZ will append a .LZH to the <Archive> parameter if the name of
the archive you supply does not already end in .LZH, but ONLY if there isn't
already a dot ( . ) in the name. This extra clause is for the benefit of
FidoNet users who have their mail archived in the .LZH format. i.e.:
MyFile becomes MyFile.LZH
MyFile.LZH remains MyFile.LZH
01234567.SA0 remains 01234567.SA0
A detailed description of each of LZ's commands follows:
Commands
a Add file(s) to archive
The add command will add files to a .LZH archive. If the specified
archive does not already exist, then it will automatically be created.
It is not possible to add a file which is already present in archive;
if this is attempted, then an error message will be displayed.
By default, only filenames are stored in the archive; if you wish to
store path names also, then you will have to use the -x option
(explained later). If you wish to store entire subdirectories (i.e.
descend recursively through a directory tree), then you will have to
use the -r option (explained later).
Multiple files may be added with one command. In addition, both
AmigaDOS and ARP wildcards are also supported.
Examples:
1) To add "BLAH" to "myarchive.LZH", you would enter the following
command:
Lz a myarchive.LZH blah
2) To add "THEFILE", "HI", and "KING" to "myarchive.LZH", you would
enter the following command:
Lz a myarchive.LZH thefile hi king
3) To add everything ending in ".INFO" to "myarchive.LZH", you would
enter:
Lz a myarchive.LZH #?.info
e,x Extract file(s) from archive
The extract command will extract files from an archive. If you wish
to extract files from multiple archives, then you will have to use
a wildcard. By default, all files in the archive will be extracted.
If you wish only specific files to be extracted, then the names of
these files should follow the archive name (wildcards are accepted here.)
If any file following the archive name ends in a '/' or a ':', then
that directory will be used as the destination directory in which all
extracted files will be stored.
By default, existing files will not be overwritten; instead, you will
be presented with the following:
File 'whatever' already exists -overwrite? (Yes/No/All/Quit):
Your response is hotkeyed, so it is not necessary to hit return. If
you enter "Y", then the file will be overwritten. If you enter "N",
then it will not be extracted. If "A" is entered, then all files from
then on will automatically be overwritten without prompting you. This
includes files in other archives, if you asked Lz to extract multiple
archives, using a wildcard.
If you do not wish to be prompted for existing files, then use the -m
option (explained later.)
Please note that if you wish to extract files from multiple archives
with one command, it can only be done with wildcards; you cannot enter
the name of each archive on the command line. For example:
Lz x arc1.LZH arc2.LZH arc3.LZH
The above command would attempt to extract "arc2.LZH" and "arc3.LZH"
from "arc1.LZH". The way to get around this is to type:
Lz x arc#?.LZH
However, there are often times when a single wildcard cannot cover all
of the files you wish to extract; if this is the case, you will have
to invoke Lz more than once.
Examples:
1) To extract all files from "myarchive.LZH", you would enter the
following command:
Lz x myarchive.LZH
2) To extract "BLAH" from "myarchive.LZH", you would enter the
following command:
Lz x myarchive.LZH blah
3) To extract all ".INFO" files from all archives, you would enter the
following command:
Lz x #?.LZH #?.info
4) To extract "BLAH", "WHATEVER", and all ".INFO" files from
myarchive.LZH to the destination directory "HDISK:ArchiveOutput/",
you would enter any of the following commands (they all perform
exactly the same function, since the destination directory may be
placed anywhere after the archive name):
Lz x myarchive.LZH blah whatever #?.info HDISK:ArchiveOutput/
Lz x myarchive.LZH HDISK:ArchiveOutput/ blah whatever #?.info
Lz x myarchive.LZH blah whatever HDISK:ArchiveOutput/ #?.info
l,v List files in archive
The list command will display a verbose listing of the files within the
specified archive(s) (wildcards are allowed). The listing will be in
the following format:
Original Packed Ratio Date Time CRC Name
-------- ------ --- --------- -------- ---- ------------
3026 851 71% 11-Jun-90 19:01:48 E7A9 diskspeed.a3000
841 524 37% 11-Jun-90 19:01:50 1309 si.a3000
937 586 37% 11-Jun-90 19:01:52 AE7B speed.a3000
-------- ------ ---
4804 1961 59% 3 file(s)
Heading
Meaning
Original - The size of the file before compression
Packed - The size of the file after compression
Ratio - Compression degree; the higher the better
Date - The file's creation date
Time - The file's creation time
CRC - 16-bit Cyclic Redundancy Check
Name - File name (including directory path, if present)
Examples:
1) To list all files in "myarchive.LZH", you would enter the following
command:
Lz v myarchive.LZH
2) To list all files in all archives ending in "e", you would enter the
following command:
Lz v #?e.LZH
Please note that since Lz automatically appends a .LZH to the
archive name if it does not already end in .LZH (with one exception
mentioned earlier), the following command is equally valid to the
one shown above:
Lz v #?e
d Delete file(s) from archive
The delete command will remove files from the archive. The names of
the files to be deleted should follow the archive name. Wildcards are
allowed.
Please note that items in subdirectories are also checked, so #?.info
will delete all .info files in the archive, wherever they may be.
Examples:
1) To delete "BADFILE" from myarchive.LZH, you would enter the
following command:
Lz d myarchive.LZH badfile
2) To delete "BADFILE" and all ".INFO" files from myarchive.LZH, you
would use the following command:
Lz d myarchive.LZH badfile #?.info
3) To delete all "README.BBS" files from ALL of your archives, it is
only necessary to type:
Lz d #?.LZH README.BBS
m Move file(s) to archive
The move command behaves in exactly the same way as the add command,
except that files are deleted after they are added to the archive.
Examples:
1) To move "MYFILE" to myarchive.LZH, you would enter the following
command:
Lz m myarchive.LZH myfile
2) To move all files ending in ".INFO" to myarchive.LZH, you would
enter the following command:
Lz m myarchive.LZH #?.info
f Freshen file(s) in archive
The freshen command will replace a file in the archive only if the
file is already present in the archive, and the file to be added has
a later date.
u Update file(s) in archive
The update command behaves in exactly the same way as the add command,
unless a file to be added is already present in the archive, in which
case LZ will compare the dates of both files, and will make sure that
the newer file is added to/retained in the archive.
t Test archive integrity
The test command will test every file in the archive (by extracting
it internally), and will inform you of any corrupted files (i.e. files
which fail their CRC.)
Examples:
1) To test all files in myarchive.LZH, you would enter the following
command:
Lz t myarchive.LZH
2) To test all files in all archives, you would enter the following
command:
Lz t #?.LZH
3) To test the file named "boing" in the archive "splat.lzh", you would
enter the following command:
Lz t splat.LZH boing
4) To test all files starting with "ping" in the archive "bleh.lzh",
you would enter the following comand:
Lz t bleh.lzh ping#?
Options
-0 Lharc compression
This option is the default, and causes files to be archived with LZ's
modified Lharc algorithm.
-2 LHA compression
This option causes the more efficient LHA compression algorithm to be
used. This option will generate smaller files than the above.
-a Preserve file attributes
When this option is used, any files added to the archive will have
their attributes preserved (the default is for all files to be rwed).
The eight possible attributes are listed below, but will not be
explained here (a full explanation should be present in any AmigaDOS
manual):
r: Read
w: Write
e: Execute
d: Delete
s: Script
a: Archive
p: Protect
h: Hidden
If this option is not specified, then all files archived or extracted
will automatically be "rwed." If this flag is used, then all
attributes (rwedsaph) will be preserved. Please note that in order for
attributes to be preserved, the -a option must be used both when
archiving and extracting.
When extracting, use -a only on files which have been compressed by
Amiga .LZH archivers; if you don't, you'll end up with files with
strange attributes, although no harm will be done. Similarly, if you
know that your archive might be extracted on an IBM system, you should
not use the -a option, since they will have similar problems.
-A This option will set the archive flag of any archive LZ creates or
adds files to. It will also unset the executable flag. Thus, your
archive will have the following flags set:
---arw-d
-b Set i/o buffer size
This option will set the i/o buffer size to the number immediately
following the option, which must be expressed in K. For example,
-b32 would give you a 32k i/o buffer. LZ's i/o buffer size is limited
only by available memory, so very large buffer sizes (128k+) are
acceptable.
Note that changing the i/o buffer size on an 68000 Amiga when all work
is being done in a RAM drive doesn't speed things up; these options are
mainly for floppy drive users and 68020-68040 users.
-c Confirm file names
This option will cause LZ to prompt you with yes/no/all/quit for every
file to be added to or extracted from an archive. This option can be
useful when used in conjunction with wildcards.
-D Alternate display mode
This options alters the layout of LZ's screen updates. For example,
-D1 will use the characters -\|/ to mimic MS-DOS pre 1.10 Pkzip, while
-D2 will mimc MS-DOS Pkzip 1.10's percentage update. The -D3 option
causes the running byte count to be suppressed when decompressing, and
is the recommended setting for accelerated systems.
-D0 is the default, and activates the standard LZ display.
-f Ignore filenotes
The -f flag will cause LZ to ignore filenotes when archiving or
extracting files.
-i Read file list from file
This option allows you to specify that LZ read a list of files to be
archived, from a text file. Entering -iRAM:FileList will cause LZ
to read the names of the files stored in RAM:FileList.
-l Lower case filenames
This option forces all file names to lower case. If used when
archiving, all files added will have their names converted to lower
case. If used when extracting, all files extracted will have their
names converted to lower case.
-L Create list file
This option causes LZ to create a text file containing a list of all
files added to an archive. For example:
LZ -LRAM:ListFile a RAM:Archive.lzh hello/blah1 blah2
will cause LZ to create a file named "ListFile" containing:
hello/blah1
blah2
-m No message query
Invoking this option will prevent LZ from prompting you for input. It
will also cause files to be automatically overwritten if they already
exist. This is often useful in conjunction with scripts and BBS's.
-n No progress indicator
This option will prevent LZ from displaying a byte count as it extracts
or archives files. This can be useful if you are redirecting the
output of LZ to a file.
-N No console output (or "absolutely no progress indicator")
If this option is invoked, LZ will not display any text to the screen.
This option automatically turns on the -m option, so that if LZ ever
does require input from you, it won't just sit there.
This option is useful in conjunction with BBS software. Note the
differences between this option and the -n option. Also note that this
option is incompatible with Amiga Lharc, to which -N and -n are one and
the same.
-p Pause after loading
This option will cause LZ to prompt you for a keypress after it has
loaded. This can be useful if you have only one floppy drive, and LZ
is on another disk.
-P Set task priority
The -P option enables you to set the task priority of LZ. The task
priority must immediately follow the -P; for example, -P1, or -P-1.
This can be useful if wish to set LZ to a negative priority and leave
it running in the background while you are calling BBS's.
-r Archive subdirectories
This option will cause LZ to recursively collect files from
subdirectories, and is usually used in conjunction with the -x option.
For example, to add all files on drive df0: (including subdirectories)
to mydisk.LZH, you would use:
LZ -x -r a mydisk.LZH DF0:#?
-u Upper case filenames
This option forces all file names to upper case. If used when
archiving, all files added will have their names converted to upper
case. If used when extracting, all files extracted will have their
names converted to upper case. This option is provided for
compatibility with MS-DOS Lharc.
-U Update rate
This option sets the rate (in bytes) at which LZ updates its byte
count (or alternate display, if set with -D). It currently defaults
to 1024 bytes. The following example sets the update rate to 4096
bytes:
-U4096
-v View mode
This option affects the formatting of the output of the view (v)
command. -v0 is the default, and causes compression information
(-lh0-, -lh1-, or -lh5-) to be displayed, while -v1 suppresses
compression information.
-w Set work directory
When creating archives, individual files are compressed in the work
directory, which defaults to T: if it exists, or the current directory
otherwise. The -w option allows the location of the work directory to
be changed; the name of the new work directory should immediately
follow the -w.
-x Preserve path names
This option forces LZ to preserve the full path names of any files
added, and is most commonly used in conjunction with the -r option.
When extracting files, this defaults to "on", and the -x0 switch must
be used to turn it off, if you do not wish files to be extractnet to
their full path names.
-z Zero compression
This option is only valid when adding files, and, if invoked, will
cause all files added to be merely stored in the archive, not
compressed. This is not a very useful option, but has been included
for the sake of completeness.
-Z Compress archives
By default, LZ will NOT attempt to compress files ending in .lzh, .lhw,
.zip, .zoo, .arc, .pak, .wrp, .zap, .dms, or .arj, since these files
are already compressed. If the -Z option is used, then files with
these extensions WILL be compressed.
Conclusion
Like Amiga Lharc, LZ uses the decimal address of its task structure for
creating temporary filenames, so that multiple copies can run simultaneously
without conflict (and no, LZ is not reentrant; I *like* global variables).
If you find yourself using certain options with LZ most of the time, you
might want to make them an alias. For example, if you find yourself typing
"Lhunarc" all the time:
alias lhunarc LZ -b32 []
The above two command works only with shells which support aliases. Your
shell might have a different way of doing it; I use AmigaDOS 1.3 and Arp 1.3.
Acknowledgements
Haruyasu Yoshizaki - For lharc.c and lzhuf.c (the algorithm)
Steve Tibbett - For showing me how to speed up Lhunarc 0.96 by 3%
For RawDoFmt(), and __tinymain
For finding the bug in the view command
For Raw() and Cooked()
For suggesting a user configurable buffer
Rob Collinsworth - For finding the bugs in the algorithm implementation
when it was in Lhwarp
Chris Larcombe - For finding the zero length file bug in version 0.81
Robert Jung - For all the information on file compression.
Timothy C. Bell - For explaining everything from semiadaptive dictionary
John G. Cleary techniques and statistical encoding to digital hash
Ian H. Witten tries and finite context models.